import {
  API_URL
} from '../../common/common';

import {
  request
} from '../_utils/request';

export function login(code) {
  return new Promise((resolve) => {
    console.log(code)
    wx.request({
      url: API_URL + '/auth/app/login',
      data: {
        code: code,
        project: 'TEACHER'
      },
      method: 'POST',
      header: {
        'content-type': 'application/json'
      },
      success(res) {
        resolve(res.data);
      },
      fail(err) {
        reject(err);
      }
    })
  });

}